<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_order_goods')) {
            Schema::create('c_order_goods', function (Blueprint $table) {
                $table->increments('id')->comment('ID');
                $table->integer('user_id')->default(0)->comment('用户ID');
                $table->integer('order_id')->default(0)->comment('订单ID');
                $table->integer('goods_id')->default(0)->comment('商品ID');
                $table->integer('goods_num')->comment('商品数');
                $table->integer('specs_id')->comment('规格ID');
                $table->decimal('goods_price')->comment('商品价格');
                $table->decimal('pay_price')->comment('支付价格');
                $table->string('goods_name', 50)->comment('商品名称');
                $table->string('goods_img', 50)->comment('商品图片');
                $table->timestamps();
                $table->comment = '订单商品表';
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_order_goods');
    }
}
